package com.zhangjun.taxprovidercomputer8002.service.Impl;

import com.zhangjun.entity.ComputedTax;
import com.zhangjun.entity.Result;
import com.zhangjun.taxprovidercomputer8002.service.ComputeService;
import com.zhangjun.util.TaxComputeUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * @author 张钧
 * @Description
 * @create 2022-09-20 13:12
 */
@Service
public class ComputeServiceImpl implements ComputeService {
	@Value("${eureka.instance.instance-id}")
	private String provider;

	@Override
	public Result<ComputedTax> computeTax(Long money) {
		ComputedTax computedTax = TaxComputeUtils.computeTax(new BigDecimal(money));
		computedTax.setProvider(provider);
		return Result.ok(computedTax);
	}
}
